// import variables from '@/styles/element-variables.scss'
import defaultSettings from "@/settings";

const { showSettings, tagsView, fixedHeader, sidebarLogo, menuInLeft } =
  defaultSettings;

const state = {
  title: "",
  theme: "#1890ff",
  showSettings: showSettings,
  tagsView: tagsView,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  menuInLeft: menuInLeft,
};

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (state.hasOwnProperty(key)) {
      state[key] = value;
      // state.menuInLeft = value;
      console.log(state.menuInLeft);
    }
  },
};

const actions = {
  changeSetting({ commit }, data) {
    console.log("commit" + JSON.stringify(data));
    commit("CHANGE_SETTING", data);
  },
  // 设置网页标题
  setTitle({ commit }, title) {
    state.title = title;
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
